GetIOByIndex
Gets the information from a specified real or simulated I/O module.
Syntax
KsError GetIOByIndex(
int Index,
SlaveStatus* Details
);
Parameters
Index: the index of the device in the I/O list. Indexes are zero based. Aliases affect this parameter.
Details: pointer to the SlaveStatus structure to receive the detailed information.
Return value
If the function succeeds, it returns errNoError
, otherwise an error code. For more information about the error code, see the KsError list.
Remarks
GetIObyIndex can only be called once a link is established and started.
Usable EtherCAT states
ecatOP
Example
Copy
SlaveStatus slaveStatus = { 0 };
nRet = GetIOByIndex(0, &slaveStatus);
if (nRet == errNoError)
{
// Check the slave information in the SlaveStatus structure.
RtPrintf("IO 0 %s: Vendor 0x%x, Product 0x%x, Revision 0x%x, Serial 0x%x\n",
slaveStatus.Name, slaveStatus.VendorId, slaveStatus.ProductCode,
slaveStatus.RevisionNumber, slaveStatus.SerialNumber);
RtPrintf("Address: Auto %d, Fixed %d, Alias %d\n",
slaveStatus.SlaveId, slaveStatus.PhysAddress, slaveStatus.AliasAddress);
RtPrintf("PDO: Input len %d, Output len %d, Index offset 0x%x\n",
slaveStatus.InputLength, slaveStatus.OutputLength, slaveStatus.VariableIndexOffset);
RtPrintf("State %d, Cycle time %d\n", slaveStatus.State, slaveStatus.CycleTime);
}
Requirements
RT | Win32 | |
---|---|---|
Minimum supported version | 4.0 | 4.0 |
Header | ksapi.h | ksapi.h |
Library | KsApi_Rtss.lib | KsApi.lib |
See also